package org.dormi.learn.primitive;

import org.dormi.learn.utils.Assert;

import java.util.Objects;

/**
 * 邮编
 *
 * @author : dormi330
 * @version : 1.0
 */
public class ZipCode extends _Primitive_ {

    private final String code;

    /* === constructor === */
    /* === constructor === */
    /* === constructor === */

    public ZipCode(String code) {
        Assert.isNotNull(code, "不能为null: ZipCode.code");
        this.code = code;
    }

    /* === hash/equals === */
    /* === hash/equals === */
    /* === hash/equals === */

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ZipCode)) return false;
        ZipCode that = (ZipCode) o;
        return Objects.equals(getCode(), that.getCode());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getCode());
    }

    /* === set/get === */
    /* === set/get === */
    /* === set/get === */

    public String getCode() {
        return code;
    }

}
